package fucai.com.fucai.db.dao.imple;

import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.exception.DbException;
import java.util.List;
import fucai.com.fucai.AppBase;
import fucai.com.fucai.db.SixThereCom;
import fucai.com.fucai.db.dao.SixThereComDao;

/**
 * Created by itte on 2015/12/16.
 */
public class SixThereComImpl implements SixThereComDao {
    private DbUtils db;

    public SixThereComImpl() {
        this.db = AppBase.db;
    }

    @Override
    public void save(SixThereCom number) {
        try {
            db.save(number);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void createDb(Class t) {
        try {
            db.createTableIfNotExist(t);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void closeDb() {
        db.close();
    }

    @Override
    public List<SixThereCom> findAllData() {
        List<SixThereCom> six = null;
        try {
          six =  db.findAll(SixThereCom.class);
        } catch (DbException e) {
            e.printStackTrace();
        }
        return six;
    }
}
